[POWERPC][XEN] Make many of the timbase routine static inline
authorJimi Xenidis <jimix@watson.ibm.com>
Fri, 1 Sep 2006 17:14:53 +0000 (13:14 -0400)
committerJimi Xenidis <jimix@watson.ibm.com>
Fri, 1 Sep 2006 17:14:53 +0000 (13:14 -0400)
Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
xen/arch/powerpc/time.c
xen/include/asm-powerpc/time.h

index 17c89f13eaee5553eb15b0735ea7b3a17f6d834b..1811985199e0e15e5dbddeffcb12f7d34eb67edc 100644 (file)
@@ -34,40 +34,6 @@ ulong ticks_per_usec;
 unsigned long cpu_khz;
 unsigned int timebase_freq;
 
-u64 get_timebase(void)
-{
-    u64 s;
-
-#ifdef __PPC64__
-    s = mftb();
-#else
-    do {
-        unsigned up;
-        unsigned lo;
-        unsigned up2;
-
-        up = mftbu();
-        lo = mftbl();
-        up2 = mftbu();
-    } while (up1 != up2);
-    s = ((ulong)up << 32) | lo;
-#endif
-    return s;
-}
-
-static ulong ns_to_tb(ulong ns)
-{
-    return (ns * timebase_freq) / 1000000000ULL;
-}
-
-static ulong tb_to_ns(ulong tb)
-{
-    return tb * (1000000000ULL / timebase_freq);
-}
-
-/*
- * Return nanoseconds from time of boot
- */
 s_time_t get_s_time(void)
 {
     return tb_to_ns(get_timebase());
index d0692230a51eae1becb7fade22799189d805e3e7..3ec8e0ba6463558d70620fd17c99a42988d0523c 100644 (file)
  * along with this program; if not, write to the Free Software
  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
- * Copyright (C) IBM Corp. 2005
+ * Copyright (C) IBM Corp. 2005, 2006
  *
  * Authors: Hollis Blanchard <hollisb@us.ibm.com>
+ *          Hollis Blanchard <jimix@watson.ibm.com>
  */
 
 #ifndef _ASM_TIME_H_
 #define _ASM_TIME_H_
 
 #include <xen/types.h>
+#include <xen/time.h>
+#include <xen/percpu.h>
+#include <asm/processor.h>
 
 extern unsigned int timebase_freq;
 #define CLOCK_TICK_RATE timebase_freq
@@ -29,7 +33,26 @@ extern unsigned int timebase_freq;
 #define watchdog_disable() ((void)0)
 #define watchdog_enable()  ((void)0)
 
-extern u64 get_timebase(void);
+static inline u64 get_timebase(void)
+{
+    u64 s;
+
+#ifdef __PPC64__
+    s = mftb();
+#else
+    do {
+        unsigned up;
+        unsigned lo;
+        unsigned up2;
+
+        up = mftbu();
+        lo = mftbl();
+        up2 = mftbu();
+    } while (up1 != up2);
+    s = ((ulong)up << 32) | lo;
+#endif
+    return s;
+}
 
 typedef u64 cycles_t;
 static inline cycles_t get_cycles(void)
@@ -39,4 +62,15 @@ static inline cycles_t get_cycles(void)
     return c;
 }
 
+#define __nano(s) ((s) * 1000000000ULL)
+
+static inline u64 ns_to_tb(u64 ns)
+{
+    return (ns * timebase_freq) / __nano(1);
+}
+
+static inline u64 tb_to_ns(u64 tb)
+{
+    return tb * (__nano(1) / timebase_freq);
+}
 #endif